#pragma once

#include "cocos2d.h"
//#include "AppDelegate.h"
#include "EventHelper.h"
#include "MusicListManager.h"
#include "NoteManager.h"
#include "UICommon.h"

USING_NS_CC;

class MusicSelectCover :public LayerColor, public EventHelper
{
	public:
	MusicSelectCover() :EventHelper(this) {};
	~MusicSelectCover() {};
	static MusicSelectCover* create(Size size, float borderwidth, string coverpath);

	private:
	Size size;
	string coverpath;
	ClippingRectangleNode* coverImg;
	Rect coverImgArea;
	Label* startText = nullptr;

	public:
	ClippingRectangleNode* createCoverImg();
	ClippingRectangleNode* createBorder(float borderwidth);

	void changeCover(string newcoverpath);
	void onMouseMove(Event* e);
	void onMouseDown(Event* e);
};

class MusicSelectUITitle : public ClippingRectangleNode
{
	public:
	static MusicSelectUITitle* create();

	void addButton(string name, function<void()> func = nullptr, EventHelper::MouseEventType eventType = EventHelper::MouseEventType::MOUSEDOWN);
	void setActiveBtn(int index);

	vector<UICButton*> topbtns;
};

class MusicSelectInfo :public ClippingRectangleNode
{
	public:
	MusicSelectInfo();
	static MusicSelectInfo* create(Size disparea);

	private:
	ClippingRectangleNode* clipnode;
	Size disparea;
	float cellheight;
	TTFConfig nameStyle, valueStyle;
	int infoCount = 0;

	public:
	void addInfoItem(string name);
	void setInfoValue(MusicLevelListManager* mllst, int listindex, NoteManager* notemgr);
};

class MusicSelectGotoPlayScene :public LayerColor, public EventHelper
{
	public:
	MusicSelectGotoPlayScene() :EventHelper(this) {};
	static MusicSelectGotoPlayScene* create(Size size);

	private:
	LayerColor* pointer;

	void onMouseMove(Event* e);
	void onMouseDown(Event* e);
};
